<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page session="false" contentType="text/html; charset=UTF-8"%>
<link type="text/css" rel="stylesheet" href="/resources/css/board/board.css">
<link type="text/css" rel="stylesheet" href="/resources/css/board/board_write.css">
<script type="text/javascript" src="/resources/smarteditor/js/HuskyEZCreator.js" charset="utf-8"></script>
<div id="contentWrapper">
		<div id="contentWrap">
			<div id="content">
				<div id="bbsData">
					<div class="page-body">
						<div class="bbs-hd">
							<ul class="link">
								<li class="last"><a href="/board/list.htm?code=wholesale">도매회원문의</a>
								</li>
								<li><a href="/board/list.htm?code=review">구매후기</a></li>
								<li><a href="/board/list.htm?code=notice">공지사항</a></li>
								<li><a href="/board/list.htm?code=QandA">질문과 대답</a></li>
							</ul>
						</div><!-- .bbs-hd -->
						<div class="bbs-tit">
							<span class="braket">[</span> <strong>
								<c:choose>
											<c:when test="${code eq 'wholesale' }">도매회원문의</c:when>
											<c:when test="${code eq 'review' }">구매후기</c:when>
											<c:when test="${code eq 'notice' }">공지사항</c:when>
											<c:when test="${code eq 'QandA' }">질문과 대답</c:when>
										</c:choose>
								</strong> <span
							class="braket">]</span>
						</div>
						<div class="bbs-table-write">
							<form action="/board/save.htm" method="post"  style="position:relative;" autocomplete="off">
							<div id="passimg" name="passimg" style=" position:absolute; visibility:hidden;z-index:999; "></div>
							<input type="hidden" name="attach1" value="">
							<input type="hidden" name="code" value="${param.code }">
							<fieldset>
								<legend>일반게시판 쓰기</legend>
								<table summary="">
									<caption>게시판 글쓰기</caption>
									<colgroup>
										<col width="95">
										<col width="190">
										<col width="90">
										<col>
									</colgroup>
									<tbody>
										<tr>
											<th><div>NAME</div></th>
											<td><div><input id="bw_input_writer" type="text" name="hname" class="MS_input_txt input_style"></div></td>
											<th><div>PASSWORD</div></th>
											<td>
												<div>
													<input id="bw_input_passwd" type="password" name="passwd" class="MS_input_txt input_style">																																						</div>
											</td>
										</tr>
										<tr>
											<th><div>TITLE</div></th>
											<td colspan="3">
												<div class="title">
													<input id="bw_input_subject" class="MS_input_txt input_style2" type="text" name="title" value="">
												</div>
											</td>
										</tr>
										<tr>
											<th><div>CONTENT</div></th>
											<td colspan="3">
												<div>
													<textarea name="contents" id="ir1" rows="10" cols="150" style="width:766px; height:412px; display:none;"><c:if test="${not empty bbsInform}">${bbsInform.contents}</c:if></textarea>
												</div>
											</td>
										</tr>
										<tr>
											<th><div>FILE</div></th>
											<td colspan="3">
												<div>
													<input id="bw_input_file" type="text" class="MS_input_txt input_style2" name="file_name1" value="" onfocus="this.blur();upalert()"> <a href="javascript:upload('file_name1');"><img src="/images/d3/modern_simple/btn/btn_file.gif"></a>
												</div>
											</td>
										</tr>
									</tbody>
								</table>
							</fieldset>
							<dl class="bbs-link bbs-link-btm">
								<dt></dt>
								<dd>
									<input type="button" onclick="pasteHTML();" value="본문에 내용 넣기" />
									<input type="button" onclick="showHTML();" value="본문 내용 가져오기" />
									<input type="button" onclick="submitContents(this);" value="서버로 내용 전송" />
									<input type="button" onclick="setDefaultFont();" value="기본 폰트 지정하기 (궁서_24)" />
									<a class="write" href="javascript:submitContents(this);">글쓰기</a>
									<a href="/board/board.html?code=acandle_board1&amp;page=1&amp;s_id=&amp;stext=&amp;ssubject=&amp;scontent=&amp;shname=&amp;sbrand=&amp;branduid=">목록보기</a>
								</dd>
							</dl>
						</form>
						</div>
					</div><!-- .page-body -->
				</div><!-- #bbsData -->
			</div><!-- #content -->
		</div><!-- #contentWrap -->
	</div>
	
	

<script type="text/javascript">
var oEditors = [];

// 추가 글꼴 목록
//var aAdditionalFontSet = [["MS UI Gothic", "MS UI Gothic"], ["Comic Sans MS", "Comic Sans MS"],["TEST","TEST"]];

nhn.husky.EZCreator.createInIFrame({
	oAppRef: oEditors,
	elPlaceHolder: "ir1",
	sSkinURI: "/resources/smarteditor/SmartEditor2Skin.html",	
	htParams : {
		bUseToolbar : true,				// 툴바 사용 여부 (true:사용/ false:사용하지 않음)
		bUseVerticalResizer : true,		// 입력창 크기 조절바 사용 여부 (true:사용/ false:사용하지 않음)
		bUseModeChanger : true,			// 모드 탭(Editor | HTML | TEXT) 사용 여부 (true:사용/ false:사용하지 않음)
		//aAdditionalFontList : aAdditionalFontSet,		// 추가 글꼴 목록
		fOnBeforeUnload : function(){
			//alert("완료!");
		}
	}, //boolean
	fOnAppLoad : function(){
		//예제 코드
		var sHTML = "";
		oEditors.getById["ir1"].exec("PASTE_HTML", [sHTML]);
	},
	fCreator: "createSEditor2"
});

function pasteHTML() {
	var sHTML = "<span style='color:#FF0000;'>이미지도 같은 방식으로 삽입합니다.<\/span>";
	oEditors.getById["ir1"].exec("PASTE_HTML", [sHTML]);
}

function showHTML() {
	var sHTML = oEditors.getById["ir1"].getIR();
	alert(sHTML);
}
	
function submitContents(elClickedObj) {
	oEditors.getById["ir1"].exec("UPDATE_CONTENTS_FIELD", []);	// 에디터의 내용이 textarea에 적용됩니다.
	
	// 에디터의 내용에 대한 값 검증은 이곳에서 document.getElementById("ir1").value를 이용해서 처리하면 됩니다.
	try {
		console.log(elClickedObj.form.ir1.value);
		elClickedObj.form.submit();
	} catch(e) {}
}

function setDefaultFont() {
	var sDefaultFont = '궁서';
	var nFontSize = 24;
	oEditors.getById["ir1"].setDefaultFont(sDefaultFont, nFontSize);
}
</script>
